//
//  RegisterController.m
//  Happy to chat
//
//  Created by LL on 15/12/10.
//  Copyright © 2015年 LL. All rights reserved.
//

#import "RegisterController.h"

@interface RegisterController ()
@property (weak, nonatomic) IBOutlet UITextField *userName;
@property (weak, nonatomic) IBOutlet UITextField *password;
@property (weak, nonatomic) IBOutlet UITextField *email;


- (IBAction)registerAction:(id)sender;

@end

@implementation RegisterController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}





- (IBAction)registerAction:(id)sender {
    
    AVUser *user = [AVUser user];
    user.username = self.userName.text;
    user.password = self.password.text;
    user.email = self.email.text;
  
    [user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
        if (succeeded) {
            
            [self.navigationController popViewControllerAnimated:YES];
            
        } else {
            
        }
    }];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}
@end
